package Classes
{
	import Classes.Actions.IAction;
	import Classes.Actions.MoveAction;
	import Classes.Actions.SkillAction;
	
	import flash.geom.Point;

	public class ActionManager
	{
		private var m_world:World;
		private var m_action:IAction;
		private var m_actionQueue:Vector.<IAction> = new Vector.<IAction>;
		
		public function ActionManager()
		{
		}
		
		public function setWorld(world:World):void{
			m_world = world;
		}
		
		public function addMoveAction(point:Point):void{
			m_actionQueue.push(new MoveAction(point,m_world));
		}
		
		public function addSkillAction(skill:Skill):void{
			m_actionQueue.push(new SkillAction(skill));
		}		
		
		public function hasActions():Boolean{
			return (m_actionQueue.length > 0);
		}
		
		public function processActions():void{
			var i:int;
			var length:int = m_actionQueue.length;
			var queue:Vector.<IAction> = m_actionQueue;
			for(i=0;i<length;i++){
				queue[i].execute();
			}
			m_actionQueue = new Vector.<IAction>;
		}		
	}
}